
package stcu;

import stcu.robjects.*;
import com.nvlled.route.*;
import java.net.*;

public class ProbeMonitor 
    implements ObjectReceiver<ServerProbe> {

    private ObjectRouter router;
    private String name;

    public ProbeMonitor(String name, ObjectRouter router) {
        this.name = name;
        this.router = router;
        router.subscribe(ServerProbe.class, this);
    }

    public void receive(ServerProbe probe) {
        SocketAddress address = probe.getSourceAddress();
        router.deliver(new ProbeResponse(name), address);
    }
}
